package com.hmall.mapper;

import com.hmall.model.MallCart;
import com.hmall.util.MyMapper;
import com.hmall.vo.ShopVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;
@Repository
public interface MallCartMapper extends MyMapper<MallCart> {
    MallCart selectCartByUserIdProductId(@Param("userId") Integer userId, @Param("productId")Integer productId, @Param("grade") String grade);
    //根据用户id 等级 产品等 查询购物车id
    int selectCartIdByGrdWtPrUsr(@Param("userId") Integer userId, @Param("productId")Integer productId,  @Param("weight") Integer weight,@Param("grade") String grade);

    List<MallCart> selectCartByUserId(Integer userId);

    int selectCartProductCheckedStatusByUserId(Integer userId);

    List<ShopVo> selectShopIdsByUserId(@Param("userId") Integer userId);
    int myInsert(@Param("userId")Integer userId, @Param("productId")Integer productId, @Param("weight")Integer weight, @Param("checked")Integer checked);


    int checkedOrUncheckedProduct(@Param("userId") Integer userId,@Param("cartId")Integer cartId,@Param("checked") Integer checked);

    int selectCartProductCount(@Param("userId") Integer userId);


    List<MallCart> selectCheckedCartByUserId(Integer userId);

//查询用户的商家id购物车产品
    List<MallCart> selectCheckedCartByByShopId(@Param("userId") Integer userId,@Param("shopId") Integer shopId);
//查询用户的购物车产品
    List<Map<String,Object>> selectCheckedCartByUserIdproList(Integer userId);
//查询用户的所有购物车产品
    List<Map<String,Object>> selectAllCartByUserIdproList(Integer userId);

    void updateCartOnlyWeight(@Param("cart") MallCart cart);

    void deleteByUserIdcartIds(@Param("userId") Integer userId, @Param("cartIdList") List<String> cartIdList);
    void deleteBycartIds(@Param("cartIdList")List<String> cartIdList);
}

